﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace KaiXin001er
{
    public partial class tipForm : Form
    {
        private int heightMax=125;
        private int currentHeight=0;
        private int width=448;
        private int statTime=5000;
        public tipForm()
        {
            InitializeComponent();
        }
        public void tipShow()
        {
            //this.Location = new Point(this.Location.X,0);
            isUp = true;
            isDown = false;
            this.Show();
            this.timer1.Enabled = true;
            
        }
        private bool isUp = false;
        private bool isDown = false;
        private void tipForm_Load(object sender, EventArgs e)
        {
            Screen[] scs = Screen.AllScreens;
            Screen tablescreen = scs[0];
            Point pt = new Point(tablescreen.WorkingArea.Width-width,tablescreen.WorkingArea.Height);
            this.Location = pt;
        }
        int count=0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (isUp)
            {
                currentHeight += 3;
                if (currentHeight >= heightMax) { isUp = false; isDown = false; return; }
                this.Location = new Point(this.Location.X, this.Location.Y-3);
            }
            else if (isDown)
            {
                currentHeight -= 3;
                if (currentHeight <= 0) { isDown = false; isUp = false; this.timer1.Enabled = false; this.Close(); }
                this.Location = new Point(this.Location.X, this.Location.Y+3);
            }
            else
            {
                count++;
                if (count == statTime / timer1.Interval) { isUp = false; isDown = true; }
                return;
            }
            
        }
    }
}
